home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 22 / CU Amiga Magazine's Super CD-ROM 22 (1998)(EMAP Images)(GB)[!][issue 1998-05].iso / PowerPC / System / PPCReleaseDEV / Examples / Memory.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-21  |  657 b   |  38 lines

  1. /* Memory..start with runelf(SAS C)
  2.  * 
  3.  * show how to use the pool system. Basicly it`s only a test if it works:-)
  4.  *
  5.  */
  6. #include <exec/memory.h>
  7. #include <powerup/gcclib/powerup_protos.h>
  8. #include <stdio.h>
  9. #include <string.h>
  10.  
  11. #define    POOLSIZE    0x20
  12. #define    ALLOCSIZE    0x4
  13.  
  14. void    *AllocArray[(POOLSIZE/ALLOCSIZE)];
  15.  
  16. int    main(void)
  17. {
  18. void    *MyPool;
  19. ULONG    i;
  20. void    *Mem;
  21.  
  22.   if (MyPool=PPCCreatePool(MEMF_PUBLIC,POOLSIZE,POOLSIZE))
  23.   {
  24.     for (i=0;i<(POOLSIZE/ALLOCSIZE);i++)
  25.     {
  26.       Mem=PPCAllocPooled(MyPool,ALLOCSIZE);
  27.       printf("0x%lx\n",Mem);
  28.     }
  29.  
  30.     PPCDeletePool(MyPool);
  31.   }
  32.   else
  33.   {
  34.     printf("Could not open ppc.library v44+\n");
  35.   }
  36. }
  37.  
  38.